
import java.util.Scanner;

// 定义银行接口
interface IBank {
    double withdraw(double money);
}

// 工商银行实现类
class ICBC implements IBank {
    @Override
    public double withdraw(double money) {
        return money * (1 + 0.001);
    }
}

// 农业银行实现类
class ABC implements IBank {
    @Override
    public double withdraw(double money) {
        return money * (1 + 0.002);
    }
}

// 客户类
class Customer {
    public double getMoneyFromBank(IBank bank, double money) {
        return bank.withdraw(money);
    }
}

public class Test34 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String bankName = scanner.next();
        double money = scanner.nextDouble();

        Customer customer = new Customer();
        IBank bank;
        if ("ICBC".equals(bankName)) {
            bank = new ICBC();
        } else if ("ABC".equals(bankName)) {
            bank = new ABC();
        } else {
            return;
        }

        double actualMoney = customer.getMoneyFromBank(bank, money);
        System.out.println(Math.round(actualMoney));

        scanner.close();
    }
}